import { MockMethod } from "vite-plugin-mock";
import { permissionList } from "../db/data";
import { resultError, resultSuccess } from "../_utils";
import { verifyToken } from "../auth";

export default [
    {
        url: "/permissions/list",
        method: "get",
        response: ({ headers }) => {
            if (verifyToken(headers.authorization)) {
                return resultSuccess(permissionList);
            } else {
                return resultError("access token 无效", { code: 401 });
            }
        }
    }
] as MockMethod[];
